#include "ClassifierAdapter.h"

namespace  FeatureProcessing {
	namespace Adapters {

INIT_FACTORY(ClassifierAdapter)

ClassifierAdapter::ClassifierAdapter(ChaineReconnaissancePtr _classifieur){
	classifieur = _classifieur;
}

void ClassifierAdapter::setClassifieur(ChaineReconnaissancePtr _classifieur){
	classifieur = _classifieur;
}

void ClassifierAdapter::setSignal(SignalArray & _input){
	SignalArrayReaderPtr reader = new SignalArrayReader(_input);
	SignalReaderPtr tmpReader = classifieur->getReader();
	ResultArrayWriterPtr writer = new ResultArrayWriter();
	ResultWriterPtr tmpWriter = classifieur->getWriter();
	ResultArray response;

	classifieur->setReader(reader);
	//reader->setBufferSize(reader->getLen());
	classifieur->setWriter(writer);

	classifieur->recognize();
	response = writer->getResultArray();
	output = response.toSignalArray();

	classifieur->setReader(tmpReader);
	classifieur->setWriter(tmpWriter);
}

SignalArray & ClassifierAdapter::getSignal(){
	return output;
}

	}
}